<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>折线图表1</title>
    <script src="echarts.js"></script>
</head>

<body>
    <!-- 为DOM准备一个容器 -->
    <div id="main" style="width: 500px; height: 400px;"></div>
    <!-- 基于准备好的DOM，初始化echarts实例 -->
    <script type="text/javascript">
        var mychart = echarts.init(document.getElementById('main'));
        var option = {

            title: {
                text: '温度实时展示'
            },
            tooltip: {},
            legend: {
                data: ['温度'],
                textStyle: {
                    color: '#ECAD9E',
                    fontWeight: 800,
                    fontSize: 18,
                },
            },
            xAxis: {
                axisTick: {
                    alignWithLabel: true,
                    show: false
                },
                axisLabel: {
                    fontWeight: 700,
                    fontSize: 18,
                    fontFamily: 'YouYuan',

                },


                nameTextStyle: {
                    color: '#ECAD9E',
                    fontWeight: 800,
                    fontSize: 16,
                },
                name: '时间',
                nameLocation: 'end',
                type: 'category',
                data: ['55:03', '55:06', '55:09', '55:12', '55:15', '55:18', '55:21', '55:24', '55:27', '55:30', '55:33', '55:36', '55:39', '55:42'],

            },
            yAxis: {
                type: 'value',
                nameTextStyle: {
                    color: '#ECAD9E',
                    fontWeight: 800,
                    fontSize: 16,
                },
                axisLabel: {
                    fontWeight: 700,
                    fontSize: 18,
                    fontFamily: 'YouYuan',

                },
                name: '温度',
                nameLocation: 'end'
            },
            series: [{
                name: '温度',
                data: [19, 18, 17, 25, 26, 27, 18],
                type: 'line'
            }]

        };
        var res = [
            [2, 15, 14, 4, 5, 14, 16, 22, 12, 23, 14, 22, 6, 27],
            [22, 12, 23, 14, 22, 6, 27, 16, 16, 8, 15, 14, 5, 19],
            [16, 16, 8, 15, 14, 5, 19, 32, 34, 5, 36, 35, 19, 40],
            [32, 34, 5, 36, 35, 19, 40, 2, 15, 14, 4, 15, 14, 16],
            [2, 15, 14, 4, 15, 14, 16, 16, 2, 18, 15, 14, 2, 19],
            [16, 2, 18, 15, 14, 2, 19, 32, 14, 35, 6, 35, 9, 40],
            [32, 14, 35, 6, 35, 9, 40, 2, 5, 14, 4, 15, 4, 16],
            [2, 5, 14, 4, 15, 4, 16, 2, 15, 10, 4, 15, 4, 16],
            [2, 15, 10, 4, 15, 4, 16, 19, 18, 17, 25, 26, 27, 18],
        ];
        setInterval(getList, 2000);

        function getList() {
            var i = parseInt(Math.random() * res.length);
            option.series[0].data = res[i];
            mychart.setOption(option);
        };
        getList();
    </script>
</body>

</html>